home *** CD-ROM | disk | FTP | other *** search
/ Kellogg's Amérique / Kellogg's Amérique / swfobject.js < prev    next >
Text File  |  2009-01-01  |  6KB  |  148 lines

  1. /**
  2.  * SWFObject v1.4.2: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
  3.  *
  4.  * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
  5.  * http://www.opensource.org/licenses/mit-license.php
  6.  *
  7.  * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
  8.  *   legal reasons.
  9.  */
  10. if(typeof deconcept=="undefined"){var deconcept=new Object();}
  11. if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
  12. if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
  13. deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
  14. if(!document.getElementById){return;}
  15. this.DETECT_KEY=_b?_b:"detectflash";
  16. this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
  17. this.params=new Object();
  18. this.variables=new Object();
  19. this.attributes=new Array();
  20. if(_1){this.setAttribute("swf",_1);}
  21. if(id){this.setAttribute("id",id);}
  22. if(w){this.setAttribute("width",w);}
  23. if(h){this.setAttribute("height",h);}
  24. if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
  25. this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
  26. if(c){this.addParam("bgcolor",c);}
  27. var q=_8?_8:"high";
  28. this.addParam("quality",q);
  29. this.setAttribute("useExpressInstall",_7);
  30. this.setAttribute("doExpressInstall",false);
  31. var _d=(_9)?_9:window.location;
  32. this.setAttribute("xiRedirectUrl",_d);
  33. this.setAttribute("redirectUrl","");
  34. if(_a){this.setAttribute("redirectUrl",_a);}};
  35. deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
  36. this.attributes[_e]=_f;
  37. },getAttribute:function(_10){
  38. return this.attributes[_10];
  39. },addParam:function(_11,_12){
  40. this.params[_11]=_12;
  41. },getParams:function(){
  42. return this.params;
  43. },addVariable:function(_13,_14){
  44. this.variables[_13]=_14;
  45. },getVariable:function(_15){
  46. return this.variables[_15];
  47. },getVariables:function(){
  48. return this.variables;
  49. },getVariablePairs:function(){
  50. var _16=new Array();
  51. var key;
  52. var _18=this.getVariables();
  53. for(key in _18){_16.push(key+"="+_18[key]);}
  54. return _16;
  55. },getSWFHTML:function(){
  56. var _19="";
  57. if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
  58. if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
  59. _19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
  60. _19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
  61. var _1a=this.getParams();
  62. for(var key in _1a){_19+=key+"=\""+_1a[key]+"\" ";}
  63. var _1c=this.getVariablePairs().join("&");
  64. if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
  65. _19+="/>";
  66. }else{if(this.getAttribute("doExpressInstall")){
  67. this.addVariable("MMplayerType","ActiveX");}
  68. _19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
  69. _19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
  70. var _1d=this.getParams();
  71. for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
  72. var _1f=this.getVariablePairs().join("&");
  73. if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
  74. _19+="</object>";}
  75. return _19;
  76. },write:function(_20){
  77. if(this.getAttribute("useExpressInstall")){
  78. var _21=new deconcept.PlayerVersion([6,0,65]);
  79. if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
  80. this.setAttribute("doExpressInstall",true);
  81. this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
  82. document.title=document.title.slice(0,47)+" - Flash Player Installation";
  83. this.addVariable("MMdoctitle",document.title);}}
  84. if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
  85. var n=(typeof _20=="string")?document.getElementById(_20):_20;
  86. n.innerHTML=this.getSWFHTML();
  87. return true;
  88. }else{
  89. if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
  90. return false;}};
  91. deconcept.SWFObjectUtil.getPlayerVersion=function(){
  92. var _23=new deconcept.PlayerVersion([0,0,0]);
  93. if(navigator.plugins&&navigator.mimeTypes.length){
  94. var x=navigator.plugins["Shockwave Flash"];
  95. if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
  96. }else{
  97. try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
  98. catch(e){try{
  99. var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
  100. _23=new deconcept.PlayerVersion([6,0,21]);
  101. axo.AllowScriptAccess="always";}
  102. catch(e){
  103. if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
  104. catch(e){}}
  105. if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
  106. return _23;};
  107. deconcept.PlayerVersion=function(_27){
  108. this.major=_27[0]!=null?parseInt(_27[0]):0;
  109. this.minor=_27[1]!=null?parseInt(_27[1]):0;
  110. this.rev=_27[2]!=null?parseInt(_27[2]):0;
  111. };
  112. deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
  113. if(this.major<fv.major){return false;}
  114. if(this.major>fv.major){return true;}
  115. if(this.minor<fv.minor){return false;}
  116. if(this.minor>fv.minor){return true;}
  117. if(this.rev<fv.rev){return false;}
  118. return true;
  119. };
  120. deconcept.util={getRequestParameter:function(_29){
  121. var q=document.location.search||document.location.hash;
  122. if(q){
  123. var _2b=q.substring(1).split("&");
  124. for(var i=0;i<_2b.length;i++){
  125. if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
  126. return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
  127. return "";}};
  128. deconcept.SWFObjectUtil.cleanupSWFs=function(){
  129. var _2d=document.getElementsByTagName("OBJECT");
  130. for(var i=0;i<_2d.length;i++){
  131. _2d[i].style.display="none";
  132. for(var x in _2d[i]){if(typeof _2d[i][x]=="function"){_2d[i][x]=null;}}}};
  133. if(typeof window.onunload=="function"){
  134. var oldunload=window.onunload;
  135. window.onunload=function(){
  136. deconcept.SWFObjectUtil.cleanupSWFs();
  137. oldunload();};
  138. }else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}
  139. if(Array.prototype.push==null){
  140. Array.prototype.push=function(_30){
  141. this[this.length]=_30;
  142. return this.length;};}
  143.  
  144. var getQueryParamValue=deconcept.util.getRequestParameter;
  145. var FlashObject=deconcept.SWFObject; // for legacy support
  146. var SWFObject=deconcept.SWFObject;
  147.  
  148.